# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=volume_key
pkgver=0.3.12
pkgrel=5
pkgdesc="A library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases"
arch=('x86_64')
url="https://pagure.io/volume_key"
license=('GPL')
depends=('cryptsetup' 'nss' 'gpgme')
makedepends=('python' 'swig')
optdepends=('python: for python bindings')
source=("https://releases.pagure.org/volume_key/volume_key-$pkgver.tar.xz")
sha512sums=('d056154c9b9d23e4eb661946dd59ed97e116903a3afcff9d9e29258408082f33dcbb69958724143f6bf191a3da488a03b6c02af287790990ed6459e29d66553c')

prepare() {
  cd $pkgname-$pkgver
  
  find . -name ".pyc" -delete
}

build() {
  cd $pkgname-$pkgver
  export CFLAGS+=" $(python3-config --includes)"
  ./configure --prefix=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  sed -i '/#include <config.h>/d' "$pkgdir"/usr/include/volume_key/libvolume_key.h
}
